<?php
class Commercial_model extends CI_Model {

	/**
	 * @author Pwint Phyu Shwe
	 * Commerical Model for retrieving advertising information
	 */
	// table name
	private $tbl_commercial = 'commercial';

	function __construct()
	{
		// Call the Model constructor
		parent::__construct();
	}
	// get persons with paging
	function get_list($limit = 10, $offset = 0){
		$this->db->order_by('id','asc');
		$query = $this->db->get($this->tbl_commercial, $limit, $offset);
		$results = $query->result();
		return $results;
	}
	//get commercial information whether news/adv link
	function get ($cond = NULL){
		if ($cond != NULL){
			foreach ($cond as  $param => $item)
			$this->db->where($param , $item);
		}
		$query = $this->db->get($this->tbl_commercial);
		$result = array();
		foreach ($query->result() as $row){
			$result[]= $row;
		}
		$query->free_result(); //free result
		return $result;
	}
}
?>